const state = {
  formData: {
    list: [],
    title: "表单标题",
    formKey: 'form_' + new Date().getTime()
  },
  formOption: {
    submitBtn: false,
    resetBtn: false,
    form:{
      labelWidth:'80px',
      labelWidthNum: 80
    }
  },
  dragWg: {},
  selectWg: {},
  selectWgIndex: null,
  selectWginList: [],
  configTab: 'widget',
  wgCollapse: "base",
  predefineColors: [
    '#000000',
    '#666666',
    '#cccccc',
    '#ffffff',
    'rgba(255, 255, 255, 0)',
    '#ff0000',
    '#ff4500',
    '#ff8c00',
    '#ffd700',
    '#90ee90',
    '#00ced1',
    '#1e90ff',
    '#c71585'
  ]
}

const mutations = {
  setDragWg(state, payload) {
    state.dragWg = payload;
  },
  setFormOption(state,payload) {
    state.formOption = payload;
  },
  setFormData(state, payload) {
    state.formData = payload;
  },
  setSelectWg(state, payload) {
    state.selectWg = payload;
  },
  setConfigTab(state, payload) {
    state.configTab = payload;
  },
  setWgCollapse(state, payload) {
    state.wgCollapse = payload;
  },
  clearForm(state) {
    state.formOption = {
      submitBtn: false,
      resetBtn: false,
      form:{
        labelWidth:'80px',
        labelWidthNum: 80
      }
    }
    state.formData = {
      list: [],
      title: "表单标题",
      formKey: 'form_' + new Date().getTime()
    }
  }
}

export default {
  state,
  mutations
}
